import { useEffect } from "react";
import "./PerformanceObserverTest.scss";

export function PerformanceObserverTest() {
  useEffect(() => {
    const performanceObserver = new PerformanceObserver((list) => {
      list.getEntries().forEach((entry) => {
        console.log(entry); // 上报
      });
    });
    performanceObserver.observe({
      entryTypes: ["resource", "mark", "measure"],
    });

    performance.mark("registered-observer");

    performance.measure("init");

    return () => {};
  }, []);
  return (
    <>
      <img src="https://p9-passport.byteacctimg.com/img/user-avatar/4e9e751e2b32fb8afbbf559a296ccbf2~300x300.image" />
    </>
  );
}
